import pandas as pd
import numpy as np
import json

df = pd.read_excel('data1.xlsx')
df = df[['device_code','data']]
print(df.data[0])

# x = '''[GeneralFieldData(name=solar_volt, value=12.86), GeneralFieldData(name=temp, value=23.9), GeneralFieldData(name=signal_4g, value=31), GeneralFieldData(name=sound_state, value=3), GeneralFieldData(name=pa_state, value=true), GeneralFieldData(name=battery_dump_energy, value=103.60), GeneralFieldData(name=sensor_state, value={"L4_LB_1":0}), GeneralFieldData(name=ext_power_volt, value=12.86), GeneralFieldData(name=sw_version, value=F9103X-150_Standard_V1.0.0)]'''
# n = x.split('solar_volt, value=')
# print(n[1].split(')')[0])

l = []
d = {}
for t,s in df.iterrows():
    n = s[1].split('solar_volt, value=')
    # b = s[1].split('battery_dump_energy, value=')
    try:
        value = n[1].split(')')[0]
        if eval(value) < 10 and eval(value) > 0:
            # print(value)
            l.append(value)
            d[s[0]] = value

    except Exception as e:
        pass
print(l)
print(d)
    # battery = b[1].split(')')[0]
    # if eval(value) > 12.86:
    #     print('big than 12.86',value)
    # else:
    #     print('less than 12.86', value)
    # print(battery)